import { h } from "./snabbdom/h";
import { patch } from "./snabbdom/patch";

var vnode1 = h('ul', { key: 'ul' }, [
    h('li', { key: 'A' }, 'A'),
    h('li', { key: 'B' }, 'B'),
    h('li', { key: 'C' }, 'C'),
    h('li', { key: 'D' }, 'D'),
    h('li', { key: 'E' }, 'E'),
]);

var vnode2 = h('ul', { key: 'ul' }, [
    h('li', { key: 'E' }, 'E'),
    h('li', { key: 'A' }, 'A'),
    h('li', { key: 'D' }, 'D'),
    h('li', { key: 'B' }, 'B'),
    h('li', { key: 'F' }, 'FFF'),
    h('li', { key: 'C' }, 'C'),
    // h('li', { key: 'G' }, 'GGG'),
]);

// console.log(vnode);

var realDom = document.getElementById("container"),
    btn = document.getElementById("btn");
//让虚拟dom上树
patch(realDom, vnode1);

btn.onclick = () => {
    patch(vnode1, vnode2);
}